//
//  WelecomeViewController.swift
//  01-微博项目搭建
//
//  Created by Adolph on 15/5/17.
//  Copyright (c) 2015年 Adolph. All rights reserved.
//

import UIKit
import SDWebImage
class WelecomeViewController: UIViewController {

    @IBOutlet weak var BottomComstraint: NSLayoutConstraint!
    @IBOutlet weak var WelecomeLable: UILabel!
    
    @IBOutlet weak var iconView: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        //判断用户是否有账户信息
        if let urlString = sharedUserAccount?.avatar_large {
            iconView.sd_setImageWithURL(NSURL(string: urlString))
        }
       
    }
    
 
    //设置动画
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        BottomComstraint.constant = view.bounds.size.height - BottomComstraint.constant
        
        WelecomeLable.alpha = 0.0
        UIView.animateWithDuration(2.0, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 5.0, options: nil, animations: { () -> Void in
             self.view.layoutIfNeeded()
        }) { (_) -> Void in
            UIView.animateWithDuration(1.0, animations: { () -> Void in
                self.WelecomeLable.alpha = 1.0
                }, completion: { (_) -> Void in
                NSNotificationCenter.defaultCenter().postNotificationName(showMainNotification, object: "Main")
            })

        }
    }
}
